{% extends 'common/base.html' %}

{% load staticfiles %}


{% block head_js %}
    <script type="text/javascript" src="{% static "js/jquery-1.12.4.min.js" %}"></script>
    <script type="text/javascript" src="{% static "js/jquery-ui.min.js" %}"></script>
    <script type="text/javascript" src="{% static "js/slide.js" %}"></script>
{% endblock head_js %}

{% block body %}
    {% include 'common/status.html' %}

	<div class="search_bar clearfix">
        {% include 'common/logo.html' %}
		<div class="search_con fl">
			<input type="text" class="input_text fl" name="" placeholder="搜索商品">
			<input type="button" class="input_btn fr" name="" value="搜索">
		</div>
        {#    购物车    #}
        {% include 'goods/cart.html' %}
	</div>

	<div class="navbar_con">
		<div class="navbar">
			<h1 class="fl">全部商品分类</h1>
			<ul class="navlist fl">
				<li><a href="">首页</a></li>
				<li class="interval">|</li>
				<li><a href="">手机生鲜</a></li>
				<li class="interval">|</li>
				<li><a href="">抽奖</a></li>
			</ul>
		</div>
	</div>

	<div class="center_con clearfix">
		<ul class="subnav fl">
			<li><a href="#model01" class="fruit">新鲜水果</a></li>
			<li><a href="#model02" class="seafood">海鲜水产</a></li>
			<li><a href="#model03" class="meet">猪牛羊肉</a></li>
			<li><a href="#model04" class="egg">禽类蛋品</a></li>
			<li><a href="#model05" class="vegetables">新鲜蔬菜</a></li>
			<li><a href="#model06" class="ice">速冻食品</a></li>
		</ul>
		<div class="slide fl">
			<ul class="slide_pics">
                {% for ad in ads1 %}
                    <li><img src="/static/{{ ad.ad_image }}" alt="幻灯片"></li>
                {% endfor %}

{#				<li><img src="{% static "images/slide.jpg" %}" alt="幻灯片"></li>#}
{#				<li><img src="{% static "images/slide02.jpg" %}" alt="幻灯片"></li>#}
{#				<li><img src="{% static "images/slide03.jpg" %}" alt="幻灯片"></li>#}
{#				<li><img src="{% static "images/slide04.jpg" %}" alt="幻灯片"></li>#}
			</ul>
			<div class="prev"></div>
			<div class="next"></div>
			<ul class="points"></ul>
		</div>
		<div class="adv fl">
             {% for ad in ads2 %}
			<a href="{{ ad.ad_link }}"><img src="/static/{{ ad.ad_image }}"></a>
            {% endfor %}
{#			<a href="#"><img src="{% static "images/adv02.jpg" %}"></a>#}
		</div>
	</div>

{% for cag in cags %}
	<div class="list_model">
		<div class="list_title clearfix">
			<h3 class="fl" id="model01">{{ cag.cag_name }}</h3>
			<div class="subtitle fl">
				<span>|</span>
{#                显示最热门的三个商品#}
                {% for good in cag.hot %}
				<a href="{% url 'goods:detail' %}?id={{ good.id }}">{{ good.good_name }}</a>
                {% endfor %}
			</div>
			<a href="#" class="goods_more fr" id="fruit_more">查看更多 ></a>
		</div>

    {% load goods_filters %}

		<div class="goods_con clearfix">
			<div class="goods_banner fl"><img src="{% static forloop.counter|create_imgage_name  %}"></div>
			<ul class="goods_list fl">
				{% for good in cag.new %}
	                <li>
					    <h4><a href="{% url 'goods:detail' %}?id={{ good.id }}">{{ good.good_name }}</a></h4>
					    <a href="{% url 'goods:detail' %}?id={{ good.id }}"><img src="{% static good.good_image %}"></a>
					    <div class="prize">¥ {{ good.good_price }}</div>
				    </li>
				{% endfor %}
			</ul>
		</div>
	</div>

{% endfor %}

	{% block end_js %}


	<script type="text/javascript" src="{% static "js/slideshow.js" %}"></script>
	<script type="text/javascript">
		BCSlideshow('focuspic');
		var oFruit = document.getElementById('fruit_more');
		var oShownum = document.getElementById('show_count');

		var hasorder = localStorage.getItem('order_finish');

		if(hasorder)
		{
			oShownum.innerHTML = '2';
		}

		oFruit.onclick = function(){
			window.location.href = 'list.html';
		}
	</script>

    {% endblock end_js %}
{% endblock body%}